package com.ruoyi.framework.config;

import com.ruoyi.common.constant.LogMqConstants;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMqConfig {
    @Bean
    public DirectExchange loginLogExchange() {
        return new DirectExchange(LogMqConstants.OPERATOR_LOG_EXCHANGE);
    }

    @Bean
    public Queue loginLogQueue() {
        return new Queue(LogMqConstants.OPERATOR_LOG_QUEQU);
    }

    @Bean
    public Binding loginLog() {
        return BindingBuilder.bind(loginLogQueue()).to(loginLogExchange()).with(LogMqConstants.OPERATOR_LOG_ROUTE);
    }
}